import http from "@/api";
import { CarManage, CarType, DrivingType } from "@/api/interface/province/carManage";

// 车辆管理模块
// 列表查询接口
export const getCarListAPI = (params: CarManage.SearchParams) => {
  return http.get<CarManage.Row[]>("/manager/vehicleList", params, { loading: false });
};
// 添加接口
export const addCarAPI = (data: CarManage.Update) => {
  return http.post("/manager/vehicleAdd", data, { loading: false });
};
// 修改接口
export const upadateCarAPI = (data: CarManage.Update) => {
  return http.post("/manager/vehicleEdit", data, { loading: false });
};
// 删除接口
export const CarDeleteAPI = (carId: number) => {
  return http.delete(`/manager/vehicleDelete/${carId}`, { loading: false });
};
// 查看详情接口
export const CarDetailAPI = (id: number) => {
  return http.get<CarManage.DetailData>(`/manager/vehicleDetail/${id}`);
};

// 车辆类型模块
// 列表查询接口
export const getCarTypeListAPI = (params: CarType.SearchParams) => {
  return http.get<CarType.Row[]>("/manager/vehicleTypeList", params, { loading: false });
};
// 添加接口
export const addCarTypeAPI = (data: CarType.Add) => {
  return http.post("/manager/vehicleTypeAdd", data, { loading: false });
};
// 修改接口
export const upadateCarTypeAPI = (data: CarType.Add) => {
  return http.post("/manager/vehicleTypeEdit", data, { loading: false });
};
// 删除接口
export const CarTypeDeleteAPI = (id: string) => {
  return http.delete(`/manager/vehicleTypeDelete/${id}`, { loading: false });
};
// 查看详情接口
export const CarTypeDetailAPI = (id: string) => {
  return http.get<CarType.Row>(`/manager/vehicleTypeDetail/${id}`, { loading: false });
};

// 驾照类型模块
// 列表查询接口
export const getDriveTypeListAPI = () => {
  return http.get<DrivingType.Data[]>("/manager/driverLicenseTypeList");
};
// 添加接口
export const addDriveTypeAPI = (data: { typeName: string }) => {
  return http.post("/manager/driverLicenseTypeAdd", data, { loading: false });
};
// 修改接口
export const updateDriveTypeAPI = (data: { typeName: string; id: number }) => {
  return http.post("/manager/driverLicenseTypeEdit", data, { loading: false });
};
// 删除接口
export const DriveTypeDeleteAPI = (id: string) => {
  return http.delete(`/manager/driverLicenseTypeDelete/${id}`);
};
// 查看详情接口
export const DriveTypeDetailAPI = (id: string) => {
  return http.get<DrivingType.Data>(`/manager/driverLicenseTypeDetail/${id}`, { loading: false });
};
